//teleportation.sqf
#include "ACV_Constantes.h"
#ifdef __ACV_No_God_User
	if (true) exitWith {hint (Localize "STR_ACV_DISABLE");};
#endif

call ACV_FNCT_MakeUnit;

#include "ACV_ID_main_dlg.h"

private ["_display","_txt_sys"];
disableSerialization;

_display = findDisplay ACV_DLG_ID_Main_Dlg;
_txt_sys = _display displayCtrl ACV_DLG_ID_Main_TxtSystem;
[_txt_sys,localize "STR_MSG_PLACE_TELEPOTATION"] spawn ACV_FNCT_FlashMessage;

ACV_Pos = false;
ACV_Void = false;
ACV_Go = false;

onMapSingleClick "ACV_Pos = _pos;ACV_Void = true;ACV_Go = true;true;";
waitUntil {ACV_Void};
onMapSingleClick "";

if (!ACV_Go) exitWith {};

[format [localize "STR_MSG_DO_TELEPORT",(name player)]] call ACV_FNCT_BroadcastMessage;
(vehicle player) setPosATL ACV_Pos;
ACV_NET_Teleport = format ["*** ACV TELEPORT *** %1 : %2 - %3",name player,typeOf (vehicle player),ACV_Pos];
publicVariable "ACV_NET_Teleport";

sleep 0.05;
private "_code";
_code = compile "diag_log ACV_NET_Teleport;";
[ACV_BROADCAST_TO_SERVER,_code,_code] call ACV_FNCT_BroadcastCode;
closedialog 0;